package config

import "encoding/xml"

type ConfigSource interface {
	Read(root string) *ShardConfig
}
type Resource struct {
	Id       string `xml:"id"`
	URL      string `xml:"url"`
	Username string `xml:"username"`
	Password string `xml:"password"`
	Weight   int    `xml:"weight"`
}
type KeyValue struct {
	Key   string `xml:"key,attr"`
	Value string `xml:"value,attr"`
}
type Router struct {
	Id string `xml:"id"`
}

type ShardConfig struct {
	XMLName    xml.Name   `xml:"root"`
	Resources  []Resource `xml:"resources>resource"`
	ExtraInfos []KeyValue `xml:"extraInfos>kv"`
}
